package com.lu.pojo.oop.abstractc;

/**
 * @author luzhenfang
 * @date 2020 05 28
 * @description 抽象类
 * 抽象类不能被实例化，只能作为其他类的父类
 * 生来就应该被继承
 * abstract 关键字
 * 抽象方法
 *      使用 abstract 关键字修饰的方法 只有声明没有实现
 *      子类继承抽象类，一般要实现父类的抽象方法
 *      子类如果只实现部分抽象方法，那依然是抽象类
 */




abstract class   Employee{
    private String name;
    private int id;
    private double salary;

    public abstract void work();

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }


}
// 管理者
class Manage extends Employee{
    private double bonus;
    @Override
    public void work() {
        System.out.printf("我是%s,编号%d,我在%s,我的薪资:%.3f\n",this.getName(),this.getId(),"监督员工工作",this.getSalary());
    }
}

class CommonEmployee extends Employee{

    @Override
    public void work() {
        System.out.printf("我是%s,编号%d,我在%s,我的薪资:%.3f\n",this.getName(),this.getId(),"拼命加班",this.getSalary());

    }

}


public  class TestEmployee {
    public static void main(String[] args) {

        Employee manage = new Manage();
        manage.setId(1);
        manage.setName("产品经理");
        manage.setSalary(20*1000);
        manage.work();

        Employee commonEmployee = new CommonEmployee();
        commonEmployee.setId(2);
        commonEmployee.setName("员工");
        commonEmployee.setSalary(10*1000);
        commonEmployee.work();
    }
}

